package com.zdp.degisn.io.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author zhengdp
 * @Description IO操作工具类
 * @Date 2022/9/14 22:07
 * @Created by zhengdp
 */
public class IOUtils {

    private IOUtils(){}

    public static void copyIO(InputStream inputStream, OutputStream outputStream){
        try{
            byte[] read = new byte[1024*1024];
            while(inputStream.read(read) != -1){
                outputStream.write(read);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                inputStream.close();
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

}
